<!-- 我的预览 -->

<template>
  <div class="DetailMeetingRoom-MyPreview marginBottom">
    <div class="percent6">
      <div>上午</div>
      <div>下午</div>
      <div>晚上</div>
    </div>

    <div class="percent94">
      <div v-for="(timeList, i) in MAP.TIME_LIST" :key="i" class="flex">
        <div
          v-for="time in timeList"
          :key="time"
          :class="getClassStr(time)"
          @mouseenter="toEnter(time)"
          @mouseleave="toLeave(time)"
        >
          <span>{{ time }}</span>
          <div />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'MyPreview',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb(), CORE.mixWeb('record', 'record_')],

  /**
   * 本地方法 (轻量重要在前)
   */
  methods: {
    /**
     * 获取样式名称串
     */
    getClassStr(time) {
      const { one: { tagMap, recordMap }, MAP: { hoverId } } = this
      const name = 'DetailMeetingRoom-MyPreview'
      const tagStr = tagMap[time] ? ` ${name}-chosen ${name}-${tagMap[time]}` : ''
      const hoverStr = recordMap[time] === hoverId ? ` ${name}-hover` : ''
      return `flex1${tagStr}${hoverStr}`
    },

    /**
     * 鼠标进入
     */
    toEnter(time) {
      this.MAP.hoverId = this.one.recordMap[time] || ''

      const row = this.record_list.find((item) => item.id === this.MAP.hoverId)
      this.record_refTable.setCurrentRow(row)
    },

    /**
     * 鼠标离开
     */
    toLeave() {
      this.MAP.hoverId = ''
      this.record_refTable.setCurrentRow()
    },
  },
}
</script>

<style lang="scss">
@import './index.scss';
</style>
